﻿using AutoMapper;
using BaseAPI;
using MemorySiteServer.Models;
using MemorySiteServer.ViewModels.FavoriteViewModels;
using Microsoft.AspNetCore.Mvc;
using Snowflake.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MemorySiteServer.Controllers
{
    /// <summary>
    /// 收藏夹
    /// </summary>
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class FavoriteController : BaseController<Favorite>
    {
        public FavoriteController(DataContext context, IMapper mapper, IdWorker idWorker) : base(context, mapper, idWorker) { }

        /// <summary>
        /// 添加收藏夹
        /// </summary>
        /// <param name="favoriteCreateRequest"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResponseModel<string>> Create(FavoriteCreateRequest favoriteCreateRequest)
        {
            return await Z_Create(favoriteCreateRequest);
        }

        /// <summary>
        /// 修改收藏夹
        /// </summary>
        /// <param name="favoritePatchRequest"></param>
        /// <returns></returns>
        [HttpPatch]
        public async Task<ResponseModel<string>> Modify(FavoritePatchRequest favoritePatchRequest)
        {
            return await Z_Modify(favoritePatchRequest);
        }

        /// <summary>
        /// 删除收藏夹
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<ResponseModel<string>> Delete(long id)
        {
            return await Z_Delete(id);
        }

    }
}
